package com.fone.player.widget.pay;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

public class WifiIcon extends View{

	public WifiIcon(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public int level = 0 ;
	
	
	@Override
	protected void onDraw(Canvas canvas) {
		Paint paint = new Paint();
		
		int ih = getHeight()/15;
		
		paint.setAntiAlias(true);
		paint.setColor(0xFFFFFFFF);
		paint.setStrokeWidth(ih*4/5);
		paint.setStyle(Paint.Style.STROKE);

		int a = 0x22; 
		
		if( level >= 4 ) paint.setAlpha(0xFF); else paint.setAlpha(a);
		canvas.drawArc(new RectF(ih*2,ih*2,ih*16,ih*16),225,90,false, paint);
		if( level >= 3 ) paint.setAlpha(0xFF);else paint.setAlpha(a);
		canvas.drawArc(new RectF(ih*4,ih*4,ih*14,ih*14),225,90,false, paint);
		if( level >= 2 ) paint.setAlpha(0xFF);else paint.setAlpha(a);
		canvas.drawArc(new RectF(ih*6,ih*6,ih*12,ih*12),225,90,false, paint);
		if( level >= 1 ) paint.setAlpha(0xFF);else paint.setAlpha(a);
		paint.setStyle(Paint.Style.FILL);
		canvas.drawArc(new RectF(ih*8,ih*8,ih*10,ih*10),0,360,false, paint);
		
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		setMeasuredDimension(60,60);
	}
}

